﻿using System;
using System.Globalization;
using System.Data;
using System.Transactions;
using NUnit.Framework;
using ContractManagementSystem.DataAccess;
using ContractManagementSystem.Entity;

namespace ContractManagementSystem.Test
{
    [TestFixture]
    class TestTimesheetDataAccess
    {
        private TransactionScope _scope;
        private TimesheetDataAccess _timesheetDataAccess;

        [SetUp]
        public void SetUp()
        {
            _scope = new TransactionScope();
        }

        [TearDown]
        public void TearDown()
        {
            _scope.Dispose();
        }

        [Test]
        public void TestUpdate_InputTimesheetEntity_Return1()
        {
            var timesheetEntity = new TimesheetEntity();
            timesheetEntity.TimesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58");
            timesheetEntity.Description = "Update";
            timesheetEntity.WorkingTime = 4;
            timesheetEntity.WorkDate = DateTime.Now;

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Update(timesheetEntity);
            const int expectedValue = 1;

            Assert.AreEqual(expectedValue,actualValue);
        }

        [Test]
        public void TestUpdate_InputTimesheetEntityWithTimesheetIdDoNotExist_Return0()
        {
            var timesheetEntity = new TimesheetEntity();
            timesheetEntity.TimesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23674ea58");
            timesheetEntity.Description = "Update";
            timesheetEntity.WorkingTime = 4;
            timesheetEntity.WorkDate = DateTime.Now;

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Update(timesheetEntity);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestUpdate_InputTimesheetEntityIsEmpty_Return0()
        {
            var timesheetEntity = new TimesheetEntity();
            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Update(timesheetEntity);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public  void TestInsert_InputTimesheetEntity_Return1()
        {
            var timesheetEntity = new TimesheetEntity();
            timesheetEntity.ContractId = new Guid("0f51470b-5e28-46ed-9c1c-cb9e4b6e89cc");
            timesheetEntity.Description = "Insert";
            timesheetEntity.WorkingTime = 4;
            timesheetEntity.WorkDate = DateTime.Now;

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Insert(timesheetEntity);
            const int expectedValue = 1;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestInsert_InputTimesheetWithContractIdDoNotExist_Return0()
        {
            var timesheetEntity = new TimesheetEntity();
            timesheetEntity.ContractId = new Guid("0f51470b-5e28-46ed-9c1c-cb9e4b6a89cc");
            timesheetEntity.Description = "Insert";
            timesheetEntity.WorkingTime = 4;
            timesheetEntity.WorkDate = DateTime.Now;

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Insert(timesheetEntity);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestInsert_InputTimesheetEntityIsEmpty_Return0()
        {
            var timesheetEntity = new TimesheetEntity();

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Insert(timesheetEntity);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestDelete_InputTimesheetId_Return1()
        {
            var timesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Delete(timesheetId);
            const int expectedValue = 1;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestDelete_InputTimesheetIdDoNotExist_Return0()
        {
            var timesheetId = new Guid("0f51470b-5e2a-460d-9c1c-cb9e4b6e89cc");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Delete(timesheetId);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestRejectTimesheet_InputTimesheetIdAndContent_Return2()
        {
            var timesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58");
            string content = "test";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.RejectTimesheet(timesheetId,content);
            const int expectedValue = 2;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestRejectTimesheet_InputTimesheetIdDoNotExistAndContent_Return0()
        {
            var timesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee78");
            string content = "test";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.RejectTimesheet(timesheetId, content);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestRejectTimesheet_InputTimesheetIdAndContentIsEmpty_Return2()
        {
            var timesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58");
            string content="";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.RejectTimesheet(timesheetId, content);
            const int expectedValue = 2;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestRejectTimesheet_InputTimesheetIdWithStatusOfTimesheetIsRejectAndContent_Return2()
        {
            var timesheetId = new Guid("8821c0b0-94cc-4c6a-ae01-675573e8ae76");
            string content = "";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.RejectTimesheet(timesheetId, content);
            const int expectedValue = 2;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestInactive_InputTimesheetId_Return2()
        {
            var timesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Inactive(timesheetId);
            const int expectedValue = 1;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestInactive_InputTimesheetIdDoNotExist_Return0()
        {
            var timesheetId = new Guid("b55213b5-1b6b-45d9-ac19-06f23677ee58");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Inactive(timesheetId);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestInactive_InputTimesheetIdWithActiveOfTimesheetIsFalse_Return1()
        {
            var timesheetId = new Guid("d7d64b31-7e05-40b6-8d73-c6b4c828e8d6");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.Inactive(timesheetId);
            const int expectedValue = 1;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsAndBacthTypeIsUpdate_Return3()
        {
            DataTable source = new DataTable{Locale = CultureInfo.CurrentCulture};
            source.Columns.Add("TimesheetId",typeof(Guid));
            source.Columns.Add("Description", typeof(string));
            source.Columns.Add("WorkingTime", typeof(float));
            source.Columns.Add("WorkDate", typeof(DateTime));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a060de"), "Row1", 4, DateTime.Now);

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Update);
            const int expectedValue = 3;

            Assert.AreEqual(expectedValue,actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable0RowAndBacthTypeIsUpdate_Return0()
        {
            DataTable source = new DataTable { Locale = CultureInfo.CurrentCulture };
            source.Columns.Add("TimesheetId", typeof(Guid));
            source.Columns.Add("Description", typeof(string));
            source.Columns.Add("WorkingTime", typeof(float));
            source.Columns.Add("WorkDate", typeof(DateTime));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Update);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsWith1RowHaveTimesheetIdDoNotExistAndBacthTypeIsUpdate_Return2()
        {
            DataTable source = new DataTable { Locale = CultureInfo.CurrentCulture };
            source.Columns.Add("TimesheetId", typeof(Guid));
            source.Columns.Add("Description", typeof(string));
            source.Columns.Add("WorkingTime", typeof(float));
            source.Columns.Add("WorkDate", typeof(DateTime));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c63ad"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a060de"), "Row1", 4, DateTime.Now);

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Update);
            const int expectedValue = 2;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsAndBacthTypeIsInsert_Return3()
        {
            DataTable source = new DataTable { Locale = CultureInfo.CurrentCulture };
            source.Columns.Add("ContractId", typeof(Guid));
            source.Columns.Add("Description", typeof(string));
            source.Columns.Add("WorkingTime", typeof(float));
            source.Columns.Add("WorkDate", typeof(DateTime));

            source.Rows.Add(new Guid("274a8866-1050-40ef-857d-69d6742cb940"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("0f51470b-5e28-46ed-9c1c-cb9e4b6e89cc"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("0f51470b-5e28-46ed-9c1c-cb9e4b6e89cc"), "Row1", 4, DateTime.Now);

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Insert);
            const int expectedValue = 3;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable0RowAndBacthTypeIsInsert_Return0()
        {
            DataTable source = new DataTable { Locale = CultureInfo.CurrentCulture };
            source.Columns.Add("ContractId", typeof(Guid));
            source.Columns.Add("Description", typeof(string));
            source.Columns.Add("WorkingTime", typeof(float));
            source.Columns.Add("WorkDate", typeof(DateTime));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Insert);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsWith1RowHaveContractIdDoNotExistAndBacthTypeIsInsert_Return0()
        {
            DataTable source = new DataTable { Locale = CultureInfo.CurrentCulture };
            source.Columns.Add("ContractId", typeof(Guid));
            source.Columns.Add("Description", typeof(string));
            source.Columns.Add("WorkingTime", typeof(float));
            source.Columns.Add("WorkDate", typeof(DateTime));

            source.Rows.Add(new Guid("274a8866-1050-40ef-857d-69d6742cb940"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("0f51470b-5e28-46ed-9c1c-cb9e4b6e89cc"), "Row1", 4, DateTime.Now);
            source.Rows.Add(new Guid("0f51470b-5e28-46ed-9c1c-cb9e4b6e80cc"), "Row1", 4, DateTime.Now);

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Insert);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsAndBacthTypeIsDelete_Return3()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof (Guid));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"));
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"));
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a060de"));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Delete);
            const int expectedValue = 3;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable0RowAndBacthTypeIsDelete_Return0()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Delete);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsWith1RowHaveTimesheetIdDoNotExistAndBacthTypeIsDelete_Return2()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"));
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"));
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a061de"));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Delete);
            const int expectedValue = 2;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsAndTypeIsInactive_Return3()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"));
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"));
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a060de"));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Inactive);
            const int expectedValue = 3;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable0RowAndTypeIsInactive_Return0()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Inactive);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsWith1RowHaveTimesheetIdDoNotExistAndTypeIsInactive_Return2()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"));
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"));
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a061de"));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Inactive);
            const int expectedValue = 2;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsAndTypeIsReject_Return3()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));
            source.Columns.Add("Reason", typeof(string));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"), "Row1");
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"), "Row1");
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a060de"), "Row1");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Reject);
            const int expectedValue = 3;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable0RowAndTypeIsReject_Return0()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));
            source.Columns.Add("Reason", typeof(string));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Reject);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsWith1RowHaveTimesheetIdDoNotExistAndTypeIsReject_Return0()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));
            source.Columns.Add("Reason", typeof(string));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"), "Row1");
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"), "Row1");
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a061de"), "Row1");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Reject);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsAndTypeIsApproved_Return3()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"));
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"));
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a060de"));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Approved);
            const int expectedValue = 3;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable0RowAndTypeIsApproved_Return0()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Approved);
            const int expectedValue = 0;

            Assert.AreEqual(expectedValue, actualValue);
        }

        [Test]
        public void TestBatchUpdate_InputDataTable3RowsWith1RowHaveTimesheetIdDoNotExistAndTypeIsApproved_Return0()
        {
            var source = new DataTable();
            source.Columns.Add("TimesheetId", typeof(Guid));

            source.Rows.Add(new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad"));
            source.Rows.Add(new Guid("b55213b5-1b6b-45d9-ac19-06f23674ee58"));
            source.Rows.Add(new Guid("844d95c4-422e-4548-b7e8-0b6947a061de"));

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.BatchUpdate(source, BatchType.Approved);
            const int expectedValue = 2;

            Assert.AreEqual(expectedValue, actualValue);
        }
        
        [Test]
        public void TestFetchAll_NoParameterToInput_ReturnDataTableOfTimesheetWithRowsCountMoreThan0()
        {
            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.FetchAll().Rows.Count;

            Assert.True(actualValue > 0);
        }

        [Test]
        public void TestFetchByContractId_InputContractId_ReturnDataTableOfTimesheetWithRowsCountMoreThan0()
        {
            var contractId = new Guid("274a8866-1050-40ef-857d-69d6742cb940");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.FetchByContractId(contractId).Rows.Count;

            Assert.True(actualValue > 0);
        }

        [Test]
        public void TestFetchByTimesheetId_InputTimesheetId_ReturnDataTableOfTimesheetWithRowsCountMoreThan0()
        {
            var timesheetId = new Guid("8ad33d1b-0ff2-45d9-a89a-05a0ad6c62ad");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.FetchByTimesheetId(timesheetId).Rows.Count;

            Assert.True(actualValue > 0);
        }

        [Test]
        public void TestFetchByUserId_InputUserId_ReturnDataTableOfTimesheetWithRowsCountMoreThan0()
        {
            var userId = new Guid("1e02bfe9-0052-445f-a1a2-ab239571776a");

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.FetchByUserId(userId).Rows.Count;

            Assert.True(actualValue > 0);
        }

        [Test]
        public void TestTimesheetSearch_InputParameter_ReturnDataTableOfTimesheetWithRowsCountMoreThan0()
        {
            var fromDate = Convert.ToDateTime("05/05/2012");
            var toDate = Convert.ToDateTime("08/05/2012");
            var contracId = new Guid("274a8866-1050-40ef-857d-69d6742cb940");
            var contractorId = new Guid("a5df4224-dd25-4125-9098-88637e7bdc40");
            const string status = "All";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.TimesheetSearch(fromDate,toDate,contracId,contractorId,status).Rows.Count;

            Assert.True(actualValue > 0);
        }
               
        [Test]
        public void TestTimesheetSearch_InputParameterWithContractIdDoNotExist_ReturnDataTableEmpty()
        {
            var fromDate = Convert.ToDateTime("05/05/2012");
            var toDate = Convert.ToDateTime("08/05/2012");
            var contracId = new Guid("274a8866-1050-41ef-857d-69d6742cb940");
            var contractorId = new Guid("a5df4224-dd25-4125-9098-88637e7bdc40");
            const string status = "All";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.TimesheetSearch(fromDate, toDate, contracId, contractorId, status).Rows.Count;

            Assert.True(actualValue == 0);
        }

        [Test]
        public void TestTimesheetSearch_InputParameterWithContractorIdDoNotExist_ReturnDataTableEmpty()
        {
            var fromDate = Convert.ToDateTime("05/05/2012");
            var toDate = Convert.ToDateTime("08/05/2012");
            var contracId = new Guid("274a8866-1050-40ef-857d-69d6742cb940");
            var contractorId = new Guid("a5df4224-dd25-4125-9098-88637e7bdc41");
            const string status = "All";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.TimesheetSearch(fromDate, toDate, contracId, contractorId, status).Rows.Count;

            Assert.True(actualValue == 0);
        }

        [Test]
        public void TestTimesheetSearch_InputParameterWithFromDateLestThanToDate_ReturnDataTableEmpty()
        {
            var fromDate = Convert.ToDateTime("09/05/2012");
            var toDate = Convert.ToDateTime("08/05/2012");
            var contracId = new Guid("274a8866-1050-40ef-857d-69d6742cb940");
            var contractorId = new Guid("a5df4224-dd25-4125-9098-88637e7bdc40");
            const string status = "All";

            _timesheetDataAccess = new TimesheetDataAccess();
            int actualValue = _timesheetDataAccess.TimesheetSearch(fromDate, toDate, contracId, contractorId, status).Rows.Count;

            Assert.True(actualValue == 0);
        }
    }
}